package com.celan.year2023.month10.day09;

class Solution {
    public int splitNum(int num) {
        String numStr = String.valueOf(num);
        int n = numStr.length();
        int n1 = Integer.parseInt(numStr.substring(0, n / 2)) + Integer.parseInt(numStr.substring(n / 2, n));
        if (n % 2 == 0) {
            return n1;
        } else {
            int n2 = Integer.parseInt(numStr.substring(0, n / 2 + 1)) + Integer.parseInt(numStr.substring(n / 2 + 1, n));
            return Math.max(n1, n2);
        }
    }
}